def calculate_time(hour, minute, second):
    # 将时间格式化为 HH:MM:SS
    formatted_time = f"{hour:02}:{minute:02}:{second:02}"
    
    # 计算从当前时间到午夜的剩余秒数
    total_seconds_in_a_day = 24 * 60 * 60  # 一天有86400秒
    current_time_in_seconds = hour * 3600 + minute * 60 + second
    remaining_seconds = total_seconds_in_a_day - current_time_in_seconds
    
    # 打印输出
    print(f"{formatted_time}")
    print(f"距离午夜还剩余{remaining_seconds}秒")

# 示例输入
a = eval(input())
b = eval(input())
c = eval(input())
calculate_time(a, b, c)